class GameReset{

    Main : any;
    
    public constructor(main:GamePlay) {
        this.Main = main;
    }
    public init(){
        this.penguin();
        this.bear();
        this.Main.gametips.x = 600;
        this.Main.gametips.y = 360;
        let mx = Const.SCENT_WIDTH-this.Main.penguinOffsetX;
        let my = this.Main.floorLine;

        //设置遮罩
        //this.Main.penguinmask = new egret.Rectangle(0,0,200,this.Main.penguinHeight/2);
        this.Main.penguinmask = Common.createBitmapByName("scenebg1_png");
        this.Main.penguinmask.height = this.Main.floorLine
    }

    public replay(){
        //this.guide("100M");
        this.score("0");
        this.penguin();
        this.bear();
        this.background();
        this.endPenguin();

        // 游戏数据
        this.Main.penguin.mask = null;
        this.Main.penguinAnimation = null;
        this.Main.isPlaying = false; // 正在进行游戏
        this.Main.isQuiver = false; // 是否击中
        this.Main.canShoot = true;
        
        //this.Main.guideMoveLength = 0;
        //this.Main.guideMoveIndex = 1;
        this.Main.broadtip.x = Const.SCENT_WIDTH/8;

        if(this.Main.flyobject)
        {
            this.Main.removeChild(this.Main.flyobject);
            this.Main.flyobject = null;
        }
        if(this.Main.noshoottrace)
        {
            this.Main.removeChild(this.Main.noshoottrace)
            this.Main.noshoottrace = null;
        }
        if(this.Main.endTrace)
        {
            this.Main.removeChild(this.Main.endTrace)
            this.Main.endTrace = null;
        }
    };
    public guide(text){
		this.Main.guide.x = -this.Main.guideWidth;
		if(text){
			this.Main.guideText.text = text;
		}
    };
    public score(text){
        this.Main.scoretext.text = "得分："+text;
        this.Main.score = text;
    };
    public penguin(){
        if(this.Main.penguin)
        {
            this.Main.penguin.visible = true;
            this.Main.penguinOffsetX = this.Main.bearWidth + this.Main.penguinWidth/4;
            this.Main.penguin.x = Const.SCENT_WIDTH-this.Main.penguinOffsetX;
            this.Main.penguin.y = Const.SCENT_HEIGHT*0.28-80;
            this.Main.penguin.gotoAndPlay(0);
            this.Main.penguin.reset();
        }
        if(this.Main.penguintimer)
            this.Main.penguintimer.stop();
    };
    public bear(){
        if(this.Main.bear)
        {
            this.Main.bear.x = Const.SCENT_WIDTH-this.Main.bearWidth;
            this.Main.bear.y = this.Main.floorLine-this.Main.bearHeight;
            this.Main.bear.gotoAndPlay(5);
            this.Main.bear.reset();
        }
        if(this.Main.beartimer)
            this.Main.beartimer.stop();
    };
    public background(){
        var bg = this.Main.backGroundImg;
        this.Main.stopMove();
        bg.x = -Const.SCENT_WIDTH * 2;
    };
    public endPenguin(){

    };
}
